<select class="form-control city" name="cityId" onchange="getList(this,type='xian')" >
    <option value="0">所有市</option>
    {volist name="city" id="vo"}
    <option  value="{$key}">{$vo}</option>
    {/volist}
</select>

<select class="form-control xian" class="form-control xian" name="xianId" onchange="getList(this,type='town')" >
    <option value="0">所有区县</option>
</select>

<select class="form-control town" class="form-control town" name="townId" onchange="getVillage(this)">
    <option value="0">所有乡镇</option>
</select>

<select class="form-control village" class="form-control village" name="villageId"  >
    <option value="0">所有村</option>
</select>

<script src="__STATIC__/admin/js/jquery-3.3.1.min.js"></script>
<script>
    var areaturl = "{:url('admin/layer/getCounty')}";
    function getList(e,type) {
        $('.'+type).html('');
        var name = '';
        if(type == 'xian') {
            name = '所有区县';
            $('.town').html('');
            $('.town').append("<option value='0'>所有乡镇</option>");
            $('.village').html('');
            $('.village').append("<option value='0'>所有村</option>");
        } else if(type=='town') {
            name = '所有乡镇';
            $('.village').html('');
            $('.village').append("<option value='0'>所有村</option>");
        }
        if(e.value != 0) {
            $.ajax({
                url : areaturl,
                type : 'post',
                dataType : 'json',
                contentType : "application/json; charset=utf-8",
                data : JSON.stringify({'id':e.value}),
            }).done(function(data) {
                var $item = "<option value='0'>"+name+"</option>";
                for (let i in data){
                    $item += "<option  value='"+i+"' '>"+data[i]+"</option>";
                }
                $('.'+type).append($item);           
            });
        } else {
            $('.'+type).append("<option value='0'>"+name+"</option>");
        }

    }


    var villageurl = "{:url('admin/layer/getVillage')}";
    function getVillage(e){
        $('.village').html('');
        if(e.value != 0) {
            $.ajax({
                url : villageurl,
                type : 'post',
                dataType : 'json',
                contentType : "application/json; charset=utf-8",
                data : JSON.stringify({'id':e.value}),
            }).done(function(data) {
                var $item = "<option value='0'>所有村</option>";
                for (let i in data){
                    $item += "<option value='"+i+"' '>"+data[i]+"</option>";
                }
                $('.village').append($item);           
            });
        } else {
            $('.village').append("<option value='0'>所有村</option>");
        }
    }
</script>